
import h1 from './heading.js'
import './main.css'
import icon from './img.png'
import demoHtml from './demo.html'
import createEditor from './editor.js'
document.body.append(h1)
document.write(demoHtml)
const editor = createEditor()
document.body.appendChild(editor)

const img = new Image()
img.src = icon
document.body.append(img)
console.log(API_BASE_URL)
if(module.hot){
  let lastEditor = editor
  module.hot.accept('./editor',()=>{
    const value = lastEditor.innerHTML
    document.body.removeChild(lastEditor)
    const newEditor = createEditor()
    newEditor.innerHTML = value
    document.body.appendChild(newEditor)
    lastEditor = newEditor
    console.log('heading 模块更新了。。。')
  })

  module.hot.accept('./img.png',()=>{
    img.src = icon
  })
}


// const ul = document.createElement("ul")
// document.body.append(ul)
// fetch("https://api.github.com/users")
// fetch('api/users')//http://localhost:8085/api/users
//      .then(res=>res.json())
//      .then(data =>{
//       data.forEach(item => {
//         const li = document.createElement("li")
//         li.textContent = item.login
//          ul.append(li)
//        });
//      })